iconhelper: Move function from style context into only user
authorBenjamin Otte <otte@redhat.com>
Wed, 11 Mar 2015 20:24:05 +0000 (21:24 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 12 Mar 2015 00:15:38 +0000 (01:15 +0100)
gtk/gtkiconhelper.c
gtk/gtkstylecontext.c
gtk/gtkstylecontextprivate.h

index c76534585c2e6b56a89972aaa188c57f24fa76f2..415b55c7a31138f712a662feb9e87839f2420e00 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <math.h>
 
+#include "gtkcssenumvalueprivate.h"
 #include "gtkiconhelperprivate.h"
 #include "gtkstylecontextprivate.h"
 
@@ -238,14 +239,39 @@ ensure_stated_icon_from_info (GtkIconHelper *self,
 static GtkIconLookupFlags
 get_icon_lookup_flags (GtkIconHelper *self, GtkStyleContext *context)
 {
-  GtkIconLookupFlags flags = GTK_ICON_LOOKUP_USE_BUILTIN;
+  GtkIconLookupFlags flags;
+  GtkCssIconStyle icon_style;
+  GtkStateFlags state;
+
+  state = gtk_style_context_get_state (context);
+  flags = GTK_ICON_LOOKUP_USE_BUILTIN;
 
   if (self->priv->use_fallback)
     flags |= GTK_ICON_LOOKUP_GENERIC_FALLBACK;
   if (self->priv->pixel_size != -1 || self->priv->force_scale_pixbuf)
     flags |= GTK_ICON_LOOKUP_FORCE_SIZE;
 
-  flags |= _gtk_style_context_get_icon_lookup_flags (context);
+  icon_style = _gtk_css_icon_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_STYLE));
+
+  switch (icon_style)
+    {
+    case GTK_CSS_ICON_STYLE_REGULAR:
+      flags |= GTK_ICON_LOOKUP_FORCE_REGULAR;
+      break;
+    case GTK_CSS_ICON_STYLE_SYMBOLIC:
+      flags |= GTK_ICON_LOOKUP_FORCE_SYMBOLIC;
+      break;
+    case GTK_CSS_ICON_STYLE_REQUESTED:
+      break;
+    default:
+      g_assert_not_reached ();
+      return 0;
+    }
+
+  if (state & GTK_STATE_FLAG_DIR_LTR)
+    flags |= GTK_ICON_LOOKUP_DIR_LTR;
+  else if (state & GTK_STATE_FLAG_DIR_RTL)
+    flags |= GTK_ICON_LOOKUP_DIR_RTL;
 
   return flags;
 }
index 481048651f81e240552f157fd8088ecd7f88aa7c..2504027a112cdc2d22356227e9bb975734baf469 100644 (file)
@@ -3842,42 +3842,6 @@ _gtk_style_context_get_icon_extents (GtkStyleContext *context,
   extents->height += border.top + border.bottom;
 }
 
-GtkIconLookupFlags
-_gtk_style_context_get_icon_lookup_flags (GtkStyleContext *context)
-{
-  GtkCssIconStyle icon_style;
-  GtkIconLookupFlags flags;
-  GtkStateFlags state;
-
-  g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), 0);
-
-  icon_style = _gtk_css_icon_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_STYLE));
-
-  switch (icon_style)
-    {
-    case GTK_CSS_ICON_STYLE_REGULAR:
-      flags = GTK_ICON_LOOKUP_FORCE_REGULAR;
-      break;
-    case GTK_CSS_ICON_STYLE_SYMBOLIC:
-      flags = GTK_ICON_LOOKUP_FORCE_SYMBOLIC;
-      break;
-    case GTK_CSS_ICON_STYLE_REQUESTED:
-      flags = 0;
-      break;
-    default:
-      g_assert_not_reached ();
-      return 0;
-    }
-
-  state = gtk_style_context_get_state (context);
-  if (state & GTK_STATE_FLAG_DIR_LTR)
-    flags |= GTK_ICON_LOOKUP_DIR_LTR;
-  else if (state & GTK_STATE_FLAG_DIR_RTL)
-    flags |= GTK_ICON_LOOKUP_DIR_RTL;
-
-  return flags;
-}
-
 static AtkAttributeSet *
 add_attribute (AtkAttributeSet  *attributes,
                AtkTextAttribute  attr,
index 91e183c41ef2259fa759ab39defd538c86ba89ef..a520bf73b2b0ec783142cbaae9a5241608347515 100644 (file)
@@ -66,7 +66,6 @@ void           _gtk_style_context_get_icon_extents           (GtkStyleContext
                                                               gint                y,
                                                               gint                width,
                                                               gint                height);
-GtkIconLookupFlags _gtk_style_context_get_icon_lookup_flags  (GtkStyleContext    *context);
 
 /* Accessibility support */
 AtkAttributeSet *_gtk_style_context_get_attributes           (AtkAttributeSet    *attributes,